/*
 * @Description: 
 * @Version: 2.0
 * @Autor: wsh
 * @Date: 2023-06-20 18:20:48
 * @LastEditors: wsh
 * @LastEditTime: 2023-06-25 10:35:57
 */
// 列表
const tableConfig = {
  stripe: true,
  border: true,
  maxHeight: '80vh',
  columns: [
    { label: '养老机构', prop: 'organizationName' },
    { label: '老人姓名', prop: 'personName' },
    { label: '老人身份证号', prop: 'idCard' },
    { label: '联系方式', prop: 'oldmanPhone' },
    { label: '服务项目', prop: 'itemName' },
    { label: '护理时间', prop: 'nursingTime' },
    { label: '护理员', prop: 'nurseName' },
    { label: '服务地址', prop: 'nurseAddress' },
    // { label: '服务照片', prop: 'personType', custome: 'img' },

    {
      label: '操作',
      prop: 'menu',
      width: 300,
      fixed: 'right'
    }
  ]
}

// 详情
export const detailConfig = {
  inline: false,
  showBtn: false,
  labelPosition: 'left',
  column: [
    { label: '养老机构', prop: 'organizationName', span: 8 },
    { label: '老人姓名', prop: 'personName', span: 8 },
    { label: '老人性别', prop: 'gender', span: 8 },
    { label: '老人身份证号', prop: 'idCard', span: 8 },
    { label: '联系方式', prop: 'oldmanPhone', span: 8 },
    { label: '老人能力等级', prop: 'abilityLevel', span: 8 },
    { label: '护理时间', prop: 'nursingTime', span: 8 },
    { label: '护理员', prop: 'nurseName', span: 8 },
    { label: '护理人身份证号', prop: 'nurseIdCard', span: 8 },
    { label: '护理人联系方式', prop: 'nursePhone', span: 8 },
    { label: '服务地址', prop: 'nurseAddress', span: 8 },
    { label: '老人入住楼栋', prop: 'checkinBuilding', span: 8 },
    { label: '老人入住楼层', prop: 'checkinFloor', span: 8 },
    { label: '老人入住房间', prop: 'checkinRoom', span: 8 },
    { label: '老人入住床位号', prop: 'checkinBedCode', span: 8 },
    { label: '服务项目', prop: 'itemName', span: 8 },
    { label: '应收价格', prop: 'receivableAmount', span: 8 },
    { label: '实收价格', prop: 'realAmount', span: 8 },
  ]
}

export const baseConfig = {
  pageName: '老人服务管理',
  // 数据字典
  dictcodes: ['GENDER', 'LEVEL'],
  rowKey: 'idCard',
  api: {
    index: 'view_dpOrgPunchRecord_page',
  },
  auth: {
    index: 'view_dpOrgPunchRecord_page',
    // 批量搜索
    mulitSet: 'mulitSet'
  },
  // 当前行操作按钮
  menuBtn: [
    {
      icon: 'detail',
      label: '查看',
      type: 'primary',
      operate: 'detail',
      auth: 'view_dpOrgPunchRecord_page',
      text: true,
      show: true
    },
  ],
  dialogConfig: {
    width: '80%'
  },
  // 搜索
  searchConfig: {
    inline: true,
    showBtn: true,
    labelPosition: 'left',
    column: [
      { label: '养老机构', prop: 'organizationName', span: 8 },
      { label: '老人姓名', prop: 'personName', span: 8 },
      { label: '老人身份证号', prop: 'idCard', span: 8 },
      { label: '联系方式', prop: 'oldmanPhone', span: 8 },
      { label: '服务项目', prop: 'itemName', span: 8 },
      {
        label: '护理时间', prop: 'nursingTimeBetween', type: 'daterange', format: 'YYYY年MM月DD日',
        valueFormat: 'YYYY-MM-DD', span: 8
      },
    ]
  },
  // 列表
  tableConfig,
  // 详情
  detailConfig,
  beforeOnLoadFormate: (query) => {
    console.log(query, 'beforeOnLoadFormate');
    return new Promise((resolve, reject) => {
      console.log(query, 'Promise');
      if (query.hasOwnProperty('nursingTimeBetween')) {
        const values = Object.values(query.nursingTimeBetween)
        query.nursingTimeBetween = values.join(',')
      }
      resolve({
        ...query,
      })
    })
  },
}